package org.example.innovate.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import org.example.innovate.common.CommonResponse;
import org.example.innovate.service.PostViewService;
import org.example.innovate.vo.DishOneVo;
import org.example.innovate.vo.ListVo;
import org.example.innovate.vo.ViewVo;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

@RestController
@RequestMapping("/postView")
@Valid
public class PostViewController {

    @Resource
    private PostViewService postViewService;

    @PostMapping("/getall")
    public CommonResponse<List<ViewVo>> getAll(HttpServletRequest request) {
        return postViewService.getAll(request);
    }

    @PostMapping("/delete")
    public CommonResponse<Integer> delete(@RequestBody ListVo id) {
        return postViewService.delete(id);
    }
}
